#! /bin/bash


create(){
	echo $1
	HEIGHT=$1;
	WIDTH=$2;
	NWORKERS=$3;
	DIR="${HEIGHT}_${WIDTH}_${NWORKERS}";
	INIT_NAME="sor_init_$DIR"
	WORKER_NAME="sor_worker_$DIR"
	
	mkdir sor_benchmark_$DIR 
	touch sor_benchmark_$DIR/sor_benchmark_$DIR.name
	echo "#define N_WORKERS $NWORKERS
#define INIT_CODE \"$INIT_NAME\"
#define WORKER_CODE \"$WORKER_NAME\"
#define WIDTH $WIDTH
#define HEIGHT $HEIGHT" > sor_benchmark_$DIR/dimensions.h
	cp sor_benchmark.template/Makefile                                sor_benchmark_$DIR/Makefile                         
	cp sor_benchmark.template/sor_benchmark2.cpp                      sor_benchmark_$DIR/sor_benchmark_$DIR.cpp
	cp sor_benchmark.template/sor.h                                   sor_benchmark_$DIR/sor.h
	cp sor_benchmark.template/StopWatch.c                             sor_benchmark_$DIR/StopWatch.c
	cp sor_benchmark.template/StopWatch.h                             sor_benchmark_$DIR/StopWatch.h
	mkdir tasks/sor_init_process_$DIR/                                                        
	touch tasks/sor_init_process_$DIR/$INIT_NAME.name                                                        
	echo "#define N_WORKERS $NWORKERS
#define INIT_CODE \"$INIT_NAME\"
#define WORKER_CODE \"$WORKER_NAME\"
#define WIDTH $WIDTH
#define HEIGHT $HEIGHT" > tasks/sor_init_process_$DIR/sor.h
	cp tasks/sor_init_process.template/Makefile                       tasks/sor_init_process_$DIR/Makefile
	cp tasks/sor_init_process.template/sor_init_process2.c            tasks/sor_init_process_$DIR/sor_init_process_$DIR.c
	mkdir tasks/sor_worker_process_$DIR                                                       
	touch tasks/sor_worker_process_$DIR/$WORKER_NAME.name                                                       
	echo "#define N_WORKERS $NWORKERS
#define INIT_CODE \"$INIT_NAME\"
#define WORKER_CODE \"$WORKER_NAME\"
#define WIDTH $WIDTH
#define HEIGHT $HEIGHT" > tasks/sor_worker_process_$DIR/sor.h
	cp tasks/sor_worker_process.template/Makefile                     tasks/sor_worker_process_$DIR/Makefile
	cp tasks/sor_worker_process.template/sor_worker_process2.c        tasks/sor_worker_process_$DIR/sor_worker_process_$DIR.c 
}


create 320  256  10 
create 640  512  40
create 1280 512  80
create 2560 512  160
create 5120 512  320
create 640  1024 80
create 1280 1024 160
create 2560 1024 320





